﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PointAction : MonoBehaviour
{
    private SpriteRenderer spriteRenderer;
    private HingeJoint2D hinge;
    public Sprite idleSprite;
    public Sprite changeSprite;

    private void Awake()
    {
        hinge = GetComponent<HingeJoint2D>();
        spriteRenderer = GetComponent<SpriteRenderer>();
    }

    private void Update()
    {
        if (hinge.connectedBody != null && spriteRenderer.sprite == idleSprite)
        {
            spriteRenderer.sprite = changeSprite;
        }
        else if (hinge.connectedBody == null && spriteRenderer.sprite == changeSprite)
        {
            spriteRenderer.sprite = idleSprite;
        }


        
    }



}
